#include <iostream>

#include "boost/date_time.hpp"

using namespace std;
using namespace boost::gregorian;

int main()
{
	// 4,2,2 get 2012/12/5, not 2012/1/25
	cout << from_undelimited_string("2010125") << endl;

	// throw exceptions
	try
	{
		cout << from_undelimited_string("2010131") << endl;
	}
	catch (exception& e)
	{
		cout << e.what() << endl;
	}


	date d(2012, 1, 1);
	cout << d << endl;
	cout << "to_iso_string: " << to_iso_string(d) << endl;
	cout << "to_iso_extended_string: " << to_iso_extended_string(d) << endl;
	cout << "to_simple_string: " << to_simple_string(d) << endl;


	cout << "week_number of 2012/1/1 Sunday: " << d.week_number() << endl;

	cout << date(2010, 3, 30) - months(1) << endl;
	cout << date(2010, 2, 28) - months(1) << endl;
	cout << date(2010, 1, 29) + months(1) << endl;
}

